package oocl.custormer.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import oocl.custormer.po.Food;
import oocl.custormer.service.FoodService;
import oocl.custormer.serviceimpl.FoodServiceImpl;

/**
 * Servlet implementation class FoodServlet
 */
public class FoodServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       private FoodService fs=new FoodServiceImpl();
    /**
     * @see HttpServlet#HttpServlet()
     */
    public FoodServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		int mId=Integer.parseInt(request.getParameter("mId"));
		//String mBrand=request.getParameter("mBrand");
		
		//String sprice=request.getParameter("price");
		//double price=Double.parseDouble(sprice);
		
        List<Food> mfs=fs.findAllFood(mId);
		request.setAttribute("mfs", mfs);
		request.getRequestDispatcher("listAllFood.jsp").forward(request, response);
	}

	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
